package com.homelock.constants;

/**
 * 0x00 撬锁
 * 0x01 强行开门
 * 0x02 指纹尝试开门被冻结
 * 0x03 密码尝试开门被冻结
 * 0x04 卡尝试开门被冻结
 * 0x05钥匙尝试开门被冻结
 * 0x06遥控尝试开门被冻结
 * 0x07 胁迫开门
 * 0x08 电量低
 */
public enum ZxAlarmTypeEnum {
    PICK_ALARM((byte)0x00,"撬锁"),
    FORCE_ALAMR((byte)0x01,"强行开门"),
    FINGER_ALAMR((byte)0x02,"指纹尝试开门被冻结"),
    PWD_ALARM((byte)0x03,"密码尝试开门被冻结"),
    CARD_ALARM((byte)0x04,"卡尝试开门被冻结"),
    KEY_ALARM((byte)0x05,"钥匙尝试开门被冻结"),
    REMOTE_ALARM((byte)0x06,"遥控尝试开门被冻结"),
    COERCE_ALARM((byte)0x07,"胁迫开门"),
    BATTERT_LOW_ALARM((byte)0x08,"电量低");

    byte code;
    String name;

    ZxAlarmTypeEnum(byte code, String name) {
        this.code = code;
        this.name = name;
    }


    public static ZxAlarmTypeEnum codeValue(byte code) {
        for(ZxAlarmTypeEnum item: values()) {
            if(item.getCode() == code) {
                return item;
            }
        }
        return null;
    }

    public byte getCode() {
        return code;
    }

    public void setCode(byte code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
